<template>
    <div>
        <el-transfer
            filterable
            :filter-method="filterMethod"
            filter-placeholder="请输入姓名"
            v-model="value"
            :data="data">

        </el-transfer>
    </div>
</template>
<script>
import request from "../../../../../utils/request.js";
export default {
    props:{
        curRoleRow:{
            type:Object
        }
    },
    data() {
        const generateData = _ => {
            const data = [];
          //  console.log("curRoleRow",this.curRoleRow)
            request.post("/system/query/queryUserDetail",{}).then(function(res){
                res.data.forEach((user,index)=>{
                    data.push({
                        label:user.empname+"["+user.empcode+"]",
                        key:user.empcode,
                        code:user.empcode
                    })
                });
            });
            return data;
        };
        return {
            data: [],
            value: [],
            filterMethod(query, item) {
                return item.label.indexOf(query) > -1;
            }
        };
    },
    methods:{
        //返回父组件数据
        getValue(){
            return this.value;
        }
    },
    mounted(){
     
    },
    watch:{
        curRoleRow:{
            handler(nobj,oobj){
                console.log("curRoleRow",this.curRoleRow);
                var data = [];
                request.post("/system/query/queryUserDetail",{"notroleid":this.curRoleRow.id}).then(function(res){
                    res.data.forEach((user,index)=>{
                        data.push({
                            label:user.empname+"["+user.empcode+"]",
                            key:user.empcode,
                            code:user.empcode
                        })
                    });
                });
                this.data = data;
            },
            deep:true
        }
    }
}
</script>